package models

import "time"

type Urls struct {
	Id          int    		`gorm:"type:int;primaryKey"`
	OriginalUrl string 		`gorm:"type:text;not null"`
	ShortCode   string 		`gorm:"type:varchar(10);uniqueIndex;not null"`
	CreateAt    time.Time 	`gorm:"autoCreateTime"`
	IsCustom   	bool      	`gorm:"not null;default:false"`
	ExpiresAt   *time.Time 	`gorm:"index"`
}

type CreateUrlRequset struct{
	OriginalUrl string 		`json:"original_url" validate:"required,url"`
	CustomCode string       `json:"custom_code,omitempty" validate:"omitempty,min=4,max=10,alphanum" `
	Duration   *int64       `json:"duration,omitempty" validate:"omitempty"`
}
type UrlResponse struct{
	OriginalUrl string 		`json:"original_url"`
	ShortCodeUrl   string 	`json:"short_code_url"`
}